import request from '@/utils/request.js';

// 新增订单
export function addOrder(order) {
    return request({
        url: '/api/orders',
        method: 'post',
        data: order,
    });
}

// 修改订单
export function putOrder(order) {
    return request({
        url: '/api/orders',
        method: 'put',
        data: order,
    });
}

// 根据订单 ID 获取订单详情
export function getOrderById(id) {
    return request({
        url: '/api/orders/' + id,
        method: 'get',
    });
}

// 获取订单列表
export function getOrderList(pagenum, pagesize, UserId) {
    return request({
        url: '/api/orders',
        method: 'get',
        params: {
            pageNum: pagenum,
            pageSize: pagesize,
            userid: UserId,
        },
    });
}

// 根据订单 ID 删除订单
export function deleteOrderById(id) {
    return request({
        url: '/api/orders/' + id,
        method: 'delete',
    });
}
